/* -*- mode: c++; coding: utf-8-unix -*-
 */

#ifndef _IMAGE_H
#define _IMAGE_H

#include <string>

namespace img
{
	typedef unsigned int size_type;
	typedef double ch_pixel_type;
	
	enum Channel { None = 0, Red = 1, Green = 2, Blue = 3, Gray = 4 };
	inline Channel operator++(Channel &c, int)
	{
		Channel oldval = c;
		c = (Channel)((int)c + 1);
		return oldval;
	}
	
	class Image
	{
	public:
		class Pimp;
	private:
		Pimp *_pimp;
	public:
		Image(bool grayscale, const std::string &filename);
		Image(bool grayscale, size_type width, size_type height,
		      const std::string &outfilename);
		virtual ~Image() throw();

		size_type width() const;
		size_type height() const;

		ch_pixel_type pixel(Channel ch, size_type x, size_type y) const;
		void setPixel(Channel ch, size_type x, size_type y,
			      ch_pixel_type value);

		void save(double squeeze) const;
	};
}

#endif //_IMAGE_H
